#pragma once
#include <Windows.h>
#include <vector>

using namespace std;


struct tFrame
{
	RECT rFrame;
	POINT pAnchor;
	float fDuration;
};
class CCellAnimation
{
private:

int m_nCurrFrame;
float m_fTimeWaited;
bool m_bIsLooping;
bool m_bIsPlaying;
int m_nImageID;
float m_fSpeed;

vector<tFrame> m_vFrames;

public:
void Play()
{
	Reset();
	m_bIsPlaying = true;
}
void Stop()
{
	m_bIsPlaying = false;
}

void Resume()
{
	m_bIsPlaying = true;
}
void Reset()
{
	m_nCurrFrame = 0;
	m_fTimeWaited = 0.0f;
}
tFrame* GettFrame(int i) { return &m_vFrames[i]; }
vector<tFrame>& GetVec() { return m_vFrames; }

void SetisPlaying( bool on ) { m_bIsPlaying = on; }
void SetImageID(int _nImageID) { m_nImageID = _nImageID; }
void SetCurrFrame( int index ) { m_nCurrFrame = index; }
void SetSpeed( float speed ) { m_fSpeed = speed; }
void SetfTimeWaited( float fTime ) { m_fTimeWaited = fTime; }

bool GetisPlaying() { return m_bIsPlaying; }
int GetFrameCount() { return m_nCurrFrame; }
void Update(float _fDT);
void Render(int _nPosX, int _nPosY, bool _bIsXFlipped, float _fScale, DWORD _dwColor);

};